package cl.utalca.robot.logic;

import java.sql.Connection;
import java.util.List;

import cl.utalca.robot.dao.LanguageDAO;
import cl.utalca.robot.dto.LanguageDTO;
import cl.utalca.robot.interfaces.LanguageInterface;



public class LanguageLogic {

	public List<LanguageDTO> getLanguages(Connection c){
		
		List<LanguageDTO> resp = null;
		LanguageInterface languageDB = new LanguageDAO(c);
		
		resp = languageDB.getLanguages();
		
		return resp;
	}
	
	public LanguageDTO getLanguage(int languageId, Connection c){
		
		LanguageDTO resp = null;
		LanguageInterface languageDB = new LanguageDAO(c);
		
		resp = languageDB.getLanguage(languageId);
		
		return resp;
	}
	
	public int saveLanguage(LanguageDTO language, Connection c){
		int resp = -1;
		
		LanguageInterface languageDB = new LanguageDAO(c);
		resp = languageDB.saveLanguage(language);
		
		return resp;
	}
	
	public int updateLanguage(LanguageDTO language, Connection c){
		int resp = -1;
		
		LanguageInterface languageDB = new LanguageDAO(c);
		resp = languageDB.updateLanguage(language);
		
		return resp;
	}
	
	public int deleteLanguage(int languageId, Connection c){
		int resp = -1;
		
		LanguageInterface languageDB = new LanguageDAO(c);
		resp = languageDB.deleteLanguage(languageId);
		
		return resp;
	}
}
